<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description"/>
<meta content="B2B电商平台" name="keyword"/>

<title>B2B电商平台.店铺商品类型维护</title>
<link rel="icon" href="include/images/icss.ico" type="image/x-icon" />
<link rel="shortcut icon" href="include/images/icss.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/global.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/proManage.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/include/pagination/page.css" media="all">
<link rel="stylesheet" href="<%=path %>/include/JQuery ui/css/smoothness/jquery-ui-1.7.3.custom.css" type="text/css"></link>
<link rel="stylesheet" type="text/css" href="<%=path %>/include/sweetalert/sweetalert.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/mmt_trading.css" />
<script type="text/javascript" src="<%=path %>/include/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/JQuery ui/js/jquery-ui-1.7.3.custom.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/cookies.js"></script>
<script type="text/javascript" src="<%=path%>/include/pagination/jquery.pagination.js"></script>
<script type="text/javascript" src="<%=path%>/include/pagination/init.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.busin.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.common.js"></script>
<script type="text/javascript" src="<%=path %>/include/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/sweetalert/sweetalert-dev.js"></script>

    <link rel="stylesheet" href="<%=path%>/include/layui/css/layui.css"  media="all">
    <script type="text/javascript" src="<%=path %>/include/layui/lay/dest/layui.all.js" charset="utf-8"></script>
<style type="text/css">
	
</style>
<script type="text/javascript">
	$(function(){
		_queryList();//初始化一级分类列表
		_queryCount(); //初始化查询分类总数

		//初始化添加图片弹出框
		$("#addPicDig").dialog({
			autoOpen : false,   // 是否自动弹出窗口
			modal : true,    // 设置为模态对话框
			resizable : true,
			width : 460,   //弹出框宽度
			height : 230,   //弹出框高度
			title : "设置分类图片",  //弹出框标题
			position : "center",  //窗口显示的位置
			buttons:{
				'确定':function(){
					updatePic();
				},
				'取消':function(){
					$(this).dialog("close");
				}
			}
		});
	});
	
	//添加图片
	function addOnePic(uuid,level){
		$("#addPicId").val(uuid);
		$("#level").val(level);
		$("#imgView3").attr("src", "");
		$("#addPicDig").dialog("open");
	}
	//编辑图片
	function editOnePic(uuid,pic){
		$("#addPicId").val(uuid);
		$("#level").val(level);
		$("#imgView3").attr("src", pic);
		$("#addPicDig").dialog("open");
	}
	//查询分类总数
	function _queryCount(){
		 $.ajax({
             cache: true,
             type: "POST",
             url: "<%=path %>/sort/querySortAll.do",
             async: false,
             dataType:"json",
             error: function(request) {
               alert('操作失败，请稍候重试!');  
             },
            success:function(data){
				if(data.success){
					var cntValue=data.obj;
					$("#_count").html(cntValue);
				}
			}
        });
	}
	
	function _checkPic(sortPic){
		if(sortPic==''||sortPic=='undefined'){
			$("#picTip").show();
			return false;
		}else{
			
		}
		return true;
	}
	//更新图片pic
	function updatePic(){
		var sortPic=$("#sortPic").val();
		var addPicId=$("#addPicId").val();
		var checkFlag=_checkPic(sortPic);
		if(checkFlag){
			$.ajax({
               cache: true,
               type: "POST",
               url: "<%=path %>/sort/updatePic.do",
               async: false,
               data:{addPicId:addPicId,sortPic:sortPic},
               error: function(request) {
                 parent.swal("服务器拒绝访问!", "", "error"); 
               },
               success: function(data) {
               	data = eval('(' + data + ')');
				var msg = data.msg;
                if(data.success){
					parent.swal(msg, "", "success");
					var level=$("#level").val();
					if(level==''){
						pagination.onReload();
						setTimeout(3000);
						var paName=$("#onClickName").val(); 		//一级分类的分类名称
						var pUuid=$("#onClickId").val();	//一级分类的分类id
						var pCode=$("#onClickCode").val();	//一级分类的分类编码
						$("#_second"+pUuid).css("display",'none') ;
						$("#_second"+pUuid).removeClass().addClass("xpsort_close");
						_ifHasSub(pCode,1,pUuid,paName);
					}else{
						_queryList();
					}
					$("#addPicDig").dialog("close");
				}else {
					parent.swal(msg, "", "error");
				}
               }
         	});
		}
	}
	
	//查询二级分类列表
	var subPagination;
	function _ifHasSub(code,level,uuid,paName){
		$("#onClickId").val(uuid);
		$("#onClickCode").val(code);
		$("#onClickName").val(paName);
		if($("#_second"+uuid).css("display") == 'block'){
			$("#_second"+uuid).css("display",'none') ;
			$("#_second"+uuid).removeClass().addClass("xpsort_close");
			_reHeight("rightFrame","contentDiv");
		}else{
			var url = "<%=path %>/sort/querySortList.do";
			var data = {
					code:code,
					level:level
			};	
			$("#_second"+uuid).empty();
			var str = "";	
			str +="<div class='dataTables_paginate paging_full_numbers'>";
			str +="</div>";
			str +="<div id='subPagination"+uuid+"' ></div>";
			$("#_second"+uuid).html(str);	
						
			var pageId = "subPagination"+uuid;	
			var cKey = "tortList"+uuid;						
	  		//subPagination = _initPagination({'pageId':'subPagination\"'+uuid+'\"', 'cKey':'toSortList','url': url, 'data': data, 'rows': 10, 'callback':_initSubDataList});
	  		subPagination = _initPaginationOnly({'pageId': pageId, 'cKey':cKey,'url': url, 'data': data, 'rows': 10, 'callback':_initSubDataList});
		}
		var className = $("#cSort"+uuid).attr("class");
		if(className == "xpsort_open"){
			_xpsortOpen("cSort"+uuid);
		} else if(className == "xpsort_close"){
			_xpsortClose("cSort"+uuid);
		}
	}
	function _initSubDataList(data) {
			var d = data.rows;
	 		var total = data.total;
			var str = "";
			var onClickId=$("#onClickId").val();
			$("#_second"+onClickId +" ").find("ul.divUl").remove();
	 		for(var i=0;i<d.length;i++){
				str += "<ul class='xpsort_text xpsort_text2 divUl'>";
				str += "	<li class='W370'>" 
				if(d[i].PRODUCT_TYPE_UUID !=''){
					str +="	<em class='xpsort_arrow' id='subSort"+d[i].PRODUCT_TYPE_UUID+"' >&nbsp;</em>";
				}
				str += d[i].PRODUCT_TYPE_NAME+ "<span style='padding-left:60px;'><a class='alter' href='javascript:;' onclick=\"editSendSort('edit','"+d[i].PRODUCT_TYPE_UUID+"','"+d[i].PRODUCT_TYPE_NAME+"')\">修改</a></span></li>";
				if(d[i].PRODUCT_TYPE_PIC!=""){
					str += "	<li class='W160'><a class='sortstyle' href='javascript:;' onclick=\"editOnePic('" + d[i].PRODUCT_TYPE_UUID +"','" + d[i].PRODUCT_TYPE_PIC +"','')\" >编辑图片</a></li>";
				}else{
					str += "	<li class='W160'><a class='sortstyle' href='javascript:;' onclick=\"addOnePic('" + d[i].PRODUCT_TYPE_UUID +"','')\" >添加图片</a></li>";
				}
//				str += "	<li class='W80'><a href='' >产品列表</a></li>";
				str += "	 <li class='W90'><span>排序 </span>" 
				str +="		<select id='sortvalue"+ d[i].PRODUCT_TYPE_UUID+"' name='sortvalue'  autocomplete='off'    onchange=\"changeOrder('" + d[i].PRODUCT_TYPE_UUID +"','" + d[i].SORT_NUM +"','" + d[i].LEVEL +"')\"  >";
			    for(var j=1;j<=total;j++){
			    	if(d[i].SORT_NUM==j){
			    		str +='			<option value="'+j+'" selected="selected">'+j+' </option>';
			    	}else{
			    		str +='			<option value="'+j+'" >'+j+' </option>';
			    	}
			    }
			    str +='		</select>';
				str +="		</li>";
				str += "	 <li class='W60'><a href='#' onclick=\"delSecondClass('"+d[i].PRODUCT_TYPE_UUID+"')\">删除分类</a></li>";
				str += "</ul>";
			}
//			str +="<br/>"
//			str +="<div class='dataTables_paginate paging_full_numbers'>";
//			str +="</div>";
//			str +="<div id='subPagination"+onClickId+"' ></div>";
			$("#_second"+onClickId).show();
			$("#_second"+onClickId).prepend(str);
			_reHeight("rightFrame","contentDiv");
	 }

	//初始化一级分类列表
	var pagination;
	function _queryList(){
		var url = "<%=path %>/sort/querySortList.do";
  		pagination = _initPagination({'pageId':'pagination', 'cKey':'toSortList','url': url, 'rows': 10, 'callback':_initDataList});
  		
	}
	function _initDataList(data) {
	 		var d = data.rows;
	 		var total = data.total;
			var str = "";
			$("#ajaxSerieslist").empty();
			for(var i=0;i<d.length;i++){
				str += " <ul class='xpsort_text'>";
				str += "	 <li class='__w370 W370'>" 
				if(parseInt(d[i].TYPE_COUNT)>0){
					str +="	<em class='xpsort_open' id='cSort"+d[i].PRODUCT_TYPE_UUID+"'  onclick=\"_ifHasSub('" + d[i].PRODUCT_TYPE_CODE +"','" + d[i].LEVEL +"','" + d[i].PRODUCT_TYPE_UUID +"','"+d[i].PRODUCT_TYPE_NAME+"')\"  >&nbsp;</em>";
				}
				str += d[i].PRODUCT_TYPE_NAME+ "<a class='alter' href='javascript:;'  onclick=\"editOneClass('edit','"+d[i].PRODUCT_TYPE_UUID+"','"+d[i].PRODUCT_TYPE_NAME+"')\" >修改</a></li>";
				str += "	<li class='W160'><a class='sortstyle' href='javascript:;' onclick=\"addSecondSort('add','"+d[i].PRODUCT_TYPE_CODE+"','"+d[i].PRODUCT_TYPE_NAME+"','" + d[i].PRODUCT_TYPE_UUID +"')\" >添加二级分类</a>";
				if(d[i].PRODUCT_TYPE_PIC!=""){
					str += "  		<a class='sortstyle' href='javascript:;' onclick=\"editOnePic('" + d[i].PRODUCT_TYPE_UUID +"','" + d[i].PRODUCT_TYPE_PIC +"','" + d[i].LEVEL +"')\" >编辑图片</a></li>";
				}else{
					str += "  		<a class='sortstyle' href='javascript:;' onclick=\"addOnePic('" + d[i].PRODUCT_TYPE_UUID +"','" + d[i].LEVEL +"')\" >添加图片</a></li>";
				}
//				str += "	<li class='W80'><a href='' >产品列表</a></li>";
				str += "	<li class='W90'><span>排序 </span>" 
			    str +="		<select id='sortvalue"+ d[i].PRODUCT_TYPE_UUID+"' name='sortvalue'  autocomplete='off'    onchange=\"changeOrder('" + d[i].PRODUCT_TYPE_UUID +"','" + d[i].SORT_NUM +"','" + d[i].LEVEL +"')\"  >";
			    for(var j=1;j<=total;j++){
			    	if(d[i].SORT_NUM==j){
			    		str +='			<option value="'+j+'" selected="selected">'+j+' </option>';
			    	}else{
			    		str +='			<option value="'+j+'" >'+j+' </option>';
			    	}
			    	
			    }
			    str +='		</select>';
				str +="		</li>";
				str += "	<li class='W60'><a href='#' onclick=\"delOneClass('"+d[i].PRODUCT_TYPE_UUID+"','"+d[i].TYPE_COUNT+"')\">删除分类</a></li>";
				str += "</ul>";
				if(d[i].TYPE_COUNT>0){
					str +="	<div id='_second"+d[i].PRODUCT_TYPE_UUID+"'  class='_secondSeries' style='display:none'>";
					str +="</div>";
				}
			}
			$("#ajaxSerieslist").append(str);
			
	 }
	 //修改排序
	 function changeOrder(uuid,num,level){
	 	var sortNum=$("#sortvalue"+uuid).val();
	 	$.ajax({
                cache: true,
                type: "POST",
                url: "<%=path%>/sort/changeOrder.do?uuid="+uuid+"&sortNum="+sortNum+"&beNum="+num+"&level="+level,
                async: false,
                error: function(request) {
                  alert('服务器拒绝访问!');  
                },
                success: function(data) {
               		data = eval('(' + data + ')');
					var msg = data.msg;
                	if(data.success){
						alert(msg);
						pagination.onReload();
					}else {
						alert(msg);
					}
               }
	     });
	 }
	 
	//保存一级分类
	function addTopCategory(){
		parent.swal({   
			title: "添加一级分类",   
			type: "input",   
			showCancelButton: true,
			closeOnConfirm: false,
			cancelButtonText: "取消",
			cancelButtonColor: "#ec6c62",
			confirmButtonText: "确定",
			confirmButtonColor: "#ec6c62",  
			animation: "slide-from-top",   
			inputPlaceholder: "请输入一级分类" 
		}, function(inputValue){   
			if (inputValue === false) return false;      
			if (inputValue === "") {     
				parent.swal.showInputError("请输入!");     
				return false;   
			}   
			var seriesName=inputValue;
			$("#seriesName").val(seriesName);
				$.ajax({
	               cache: true,
	               type: "POST",
	               url: "<%=path %>/sort/saveSort.do",
	               async: false,
	               data:$('#fm').serialize(),
	               error: function(request) {
	                 alert('服务器拒绝访问!');  
	               },
	               success: function(data) {
	               	data = eval('(' + data + ')');
					var msg = data.msg;
	                if(data.success){
						parent.swal("操作成功!", "保存成功!", "success");
						_queryList();
					}else {
						parent.swal("OMG", "保存失败!", "error");
					}
	               }
	         	});
		});
	}
	
	//添加一级分类的弹出框
	function addOneClass(act){
		$("#act").val(act);
		$("#seriesName").val("");
		//$("#gradeEditDig").dialog("open");
		addTopCategory();
	}
	//修改一级分类的弹出框
	function editOneClass(act,uuid,name){
		$("#act").val(act);
		$("#doId").val(uuid);
		$("#seriesName").val(name);
		eTopCategory(name);
		//editTopCategory(name);
	}
	//修改一级分类，方法二
	function eTopCategory(name){
		parent.swal({   
			title: "修改一级分类",   
			type: "input",   
			showCancelButton: true,
			closeOnConfirm: false,
			cancelButtonText: "取消",
			cancelButtonColor: "#ec6c62",
			confirmButtonText: "确定",
			confirmButtonColor: "#ec6c62",   
			animation: "slide-from-top",   
			inputPlaceholder: name
		}, function(inputValue){ 
			if(inputValue==''){
				$("#seriesName").val(name);
			}else{
				var seriesName=inputValue;
				$("#seriesName").val(seriesName);
			} 
				$.ajax({
	               cache: true,
	               type: "POST",
	               url: "<%=path %>/sort/saveSort.do",
	               async: false,
	               data:$('#fm').serialize(),
	               error: function(request) {
	                 alert('服务器拒绝访问!');  
	               },
	               success: function(data) {
	               	data = eval('(' + data + ')');
					var msg = data.msg;
	                if(data.success){
						parent.swal("操作成功!", "保存成功!", "success");
						_queryList();
					}else {
						parent.swal("OMG", "保存失败!", "error");
					}
	               }
	         	});
		});
	}
	
	
	//修改一级分类(待完善)
	function editTopCategory(name){
		parent.swal({   
			title: "修改一级分类",   
			//text: "<span >分类名称：</span><input type='text' name='seriesName' id='editSeriesName' value='"+name+"'/>",   
			text:name,
			html: true,
			showConfirmButton: true,
			showCancelButton: true,
			cancelButtonText: "取消",
			cancelButtonColor: "#ec6c62",
			confirmButtonText: "确定",
			confirmButtonColor: "#ec6c62"
		});
	}
	
	//删除一级分类
	function delOneClass(uuid,subCnt){
		if(subCnt>0){
			parent.swal("该分类下包含二级分类，不可直接删除!请先删除二级分类!");
			return;
		}
		 parent.swal({
			title: "您确定要删除吗？", 
			type: "warning",
			showCancelButton: true,
			closeOnConfirm: false,
			cancelButtonText: "取消",
			cancelButtonColor: "#ec6c62",
			confirmButtonText: "确定",
			confirmButtonColor: "#ec6c62"
			}, function() {
				$.ajax({
	                cache: true,
	                type: "POST",
	                url: "<%=path%>/sort/delSort.do?uuid="+uuid,
	                async: false,
	                error: function(request) {
	                  alert('服务器拒绝访问!');  
	                },
	                success: function(data) {
	               		data = eval('(' + data + ')');
						var msg = data.msg;
	                	if(data.success){
							parent.swal("操作成功!", "删除成功!", "success");
							_queryList();
						}else {
							parent.swal("OMG", "删除失败!", "error");
						}
	               }
	            });
			});
	}
	
	//添加二级分类的弹出框
	function addSecondSort(act,code,name,uuid){
		$("#sAct").val(act);	//二级分类的增加或修改的标识符
		$("#pCode").val(code);  //一级分类的编码
		//$("#pName").html(name);	//一级分类的名称
		$("#secondSeriesName").val("");
		saveSecondSort(name);
	}
	//修改二级分类弹出框
	function editSendSort(act,uuid,name){
		var paName=$("#onClickName").val(); //一级分类的分类名称
		var pUuid=$("#onClickId").val();	//一级分类的分类id
		var pCode=$("#onClickCode").val();	//一级分类的分类编码
		$("#sAct").val(act); 	            //二级分类的增加或修改的标识符
		var pName=$("#onClickName").val();
		$("#secondUuid").val(uuid);
		$("#secondSeriesName").val(name);
		editSecondSort(pName,name);
	}
	//添加二级分类
	function saveSecondSort(name){
		parent.swal({   
			title: "添加二级分类",  
			text: "上级分类："+name,   
			type: "input",   
			showCancelButton: true,
			closeOnConfirm: false,
			cancelButtonText: "取消",
			cancelButtonColor: "#ec6c62",
			confirmButtonText: "确定",
			confirmButtonColor: "#ec6c62",  
			animation: "slide-from-top",   
			inputPlaceholder: "请输入二级分类" 
		}, function(inputValue){   
			if (inputValue === false) return false;      
			if (inputValue === "") {     
				parent.swal.showInputError("请输入!");     
				return false;   
			}   
			var seriesName=inputValue;
			$("#secondSeriesName").val(seriesName);
				$.ajax({
	               cache: true,
	               type: "POST",
	               url: "<%=path %>/sort/saveSort.do",
	               async: false,
	               data:$('#secondfm').serialize(),
	               error: function(request) {
	                 alert('服务器拒绝访问!');  
	               },
	               success: function(data) {
	               	data = eval('(' + data + ')');
					var msg = data.msg;
	                if(data.success){
						parent.swal("操作成功!", "保存成功！", "success");
						pagination.onReload();
						setTimeout(3000);
						var paName=$("#onClickName").val(); 		//一级分类的分类名称
						var pUuid=$("#onClickId").val();	//一级分类的分类id
						var pCode=$("#onClickCode").val();	//一级分类的分类编码
						$("#_second"+pUuid).css("display",'none') ;
						$("#_second"+pUuid).removeClass().addClass("xpsort_close");
						_ifHasSub(pCode,1,pUuid,paName);
					}else {
						parent.swal("OMG", "保存失败!", "error");
					}
	               }
	         });
		});
	}
	
	//修改二级分类
	function editSecondSort(pName,name){
		parent.swal({   
			title: "修改二级分类",  
			text: "上级分类："+pName,   
			type: "input",   
			showCancelButton: true,
			closeOnConfirm: false,
			cancelButtonText: "取消",
			cancelButtonColor: "#ec6c62",
			confirmButtonText: "确定",
			confirmButtonColor: "#ec6c62",  
			animation: "slide-from-top",   
			inputPlaceholder: name 
		}, function(inputValue){   
			if(inputValue==''){
				$("#secondSeriesName").val(name);
			}else{
				var seriesName=inputValue;
				$("#secondSeriesName").val(seriesName);
			}    
			$.ajax({
               cache: true,
               type: "POST",
               url: "<%=path %>/sort/saveSort.do",
               async: false,
               data:$('#secondfm').serialize(),
               error: function(request) {
                 alert('服务器拒绝访问!');  
               },
               success: function(data) {
               	data = eval('(' + data + ')');
				var msg = data.msg;
                if(data.success){
					parent.swal("操作成功!", "保存成功！", "success");
					pagination.onReload();
					setTimeout(3000);
					var paName=$("#onClickName").val(); 		//一级分类的分类名称
					var pUuid=$("#onClickId").val();	//一级分类的分类id
					var pCode=$("#onClickCode").val();	//一级分类的分类编码
					$("#_second"+pUuid).css("display",'none') ;
					$("#_second"+pUuid).removeClass().addClass("xpsort_close");
					_ifHasSub(pCode,1,pUuid,paName);
				}else {
					parent.swal("OMG", "保存失败!", "error");
				}
               }
         });
		});
	}
	//删除二级分类
	function delSecondClass(uuid){
		 parent.swal({
			title: "您确定要删除吗？", 
			type: "warning",
			showCancelButton: true,
			closeOnConfirm: false,
			cancelButtonText: "取消",
			cancelButtonColor: "#ec6c62",
			confirmButtonText: "确定",
			confirmButtonColor: "#ec6c62"
			}, function() {
				$.ajax({
	                cache: true,
	                type: "POST",
	                url: "<%=path%>/sort/delSort.do?uuid="+uuid,
	                async: false,
	                error: function(request) {
	                  alert('服务器拒绝访问!');  
	                },
	                success: function(data) {
	               		data = eval('(' + data + ')');
						var msg = data.msg;
	                	if(data.success){
							parent.swal("操作成功!", "删除成功!", "success");
							var paName=$("#paName").val(); 		//一级分类的分类名称
							var pUuid=$("#onClickId").val();	//一级分类的分类id
							var pCode=$("#onClickCode").val();	//一级分类的分类编码
							$("#_second"+pUuid).css("display",'none') ;
							$("#_second"+pUuid).removeClass().addClass("xpsort_close");
							//_ifHasSub(pCode,1,pUuid,paName);
							_queryList();
						}else {
							parent.swal("OMG", "删除失败!", "error");
						}
	               }
	        	});
			});
	}
</script>
</head>
  
<body style="font-family: '微软雅黑';">
<div id="contentDiv" style="margin-top: 4px;">
    <div class="colnums-2-ab-b" style="width: 99%;">
    	<div class="toptil">炫铺产品分类<div style="float: right;margin: 5px 40px 0px 0px;"></div></div>
		<input type="hidden" name="onClickId" id="onClickId"/>
		<input type="hidden" name="onClickCode" id="onClickCode"/>
		<input type="hidden" name="onClickName" id="onClickName"/>
		<dl class="tips_xp">
			<dt>提&nbsp;示</dt>
		    <dd>
		    	<span>隐藏</span>
		    	<em style="display:;" class="open" id="openOrClose">&nbsp;</em>
		    	<!-- <em style="display:none;" class="close">&nbsp;</em> -->
		    </dd>
		</dl>
		<ul class="tips_xp_text" id="tips_xp_text" style="display: ;">
			<li>您可将供应信息按产品特性进行分类并将其展示在商铺上，让买家在访问您的炫铺时更快捷以浏览产品。</li>
			<li>如果您的产品较多建议设置二级分类方便买家查找。</li>
			<li>您可为产品分类添加图片增加分类识别。</li>
		</ul>
		<p class="progra">已创建<span id="_count"></span>个产品分类</p>
		<div class="tag_x">
			<a class="sel_current">已创建的产品分类</a><em class="create" id="create"  onclick="addOneClass('add')">创建分类</em>
		</div>
		 <div class="content_xpsort" style="min-height:400px;">
			<ul class="xpsort_title">
		    	<li class="W370">分类名称</li>
		        <li class="W160">分类样式</li>
		        <!-- 
		        <li class="W80">分类产品</li>
		         -->
		        <li class="W90">排序</li>
		        <li class="W60">删除</li>
		    </ul>
			 <div id="ajaxSerieslist" >
			 </div>
			 <br/>
			<div class="dataTables_paginate paging_full_numbers">
			</div>
			<div id="pagination" ></div>
		</div>
		<div style="height:30px;"></div>
  		<!-- 分类列表div结束 -->
		<div class="clear"></div>
	</div>
	
	<!-- 新增或修改一级分类弹出框 -->
	<div id="gradeEditDig"  style="display:none;overflow:hidden;padding-top:56px;">
		<form id="fm" name="fm" class="form-horizontal form-validate" method="post" action="" novalidate="novalidate" enctype="multipart/form-data">
		<div class="content_block">
	    	<div class="xp_creat">
	        	<p class="creat_name">
	        		<label>分类名称：
	        			<input type="hidden" name="seriesName" id="seriesName" >
	        			<input type="hidden" name="doId" id="doId"/>
						<input type="hidden" name="act" id="act"/>
	        		</label><samp>最多20个字</samp>
	        	</p>
		        <div class='tips-errow' id="firstTip" style="display:none;color:red;font-size:14px;">请输入分类名称</div>
	        </div>
	    </div>
		</form>
	</div>
	
	<!-- 新增或修改二级分类弹出框 -->
	<div id="secondEditDig"  style="display:none;overflow:hidden;padding-top:20px;">
		<form id="secondfm" name="secondfm" class="form-horizontal form-validate" method="post" action="" novalidate="novalidate" enctype="multipart/form-data">
		<div class="TipBlock ui-dialog-content ui-widget-content" id="addSecondSeries" style="width: auto; min-height: 95.76px; height: auto;" scrolltop="0" scrollleft="0">
			<div class="content_block">
		    	<div class="xp_creat">
		        	<p class="seriesName"><span id="pName" style="font-size:14px;"></span></p>
		        	<p class="creat_name">
		        		<em >&nbsp;</em>
		        		<label>
		        		<input type="hidden" name="seriesName" id="secondSeriesName" >
		        		<input type="hidden" name="pCode" id="pCode"/>
		        		<input type="hidden" name="doId" id="secondUuid"/>
						<input type="hidden" name="act" id="sAct"/>
		        		</label>
		        		<samp>最多20个字</samp>
		        	</p>
		        	<div class='tips-errow' id="secondTip" style="display:none;color:red;font-size:14px;">请输入分类名称</div>
		        </div>
		    </div>
	    </div>
		</form>
	</div>
	
	
	<!-- 添加图片弹出框 -->
	<div id="addPicDig"  style="display:none;overflow:hidden;padding-top:4px;">
		<div class="TipBlock ui-dialog-content ui-widget-content" id="addSecondSeries" style="width: auto; min-height: 95.76px; height: auto;" scrolltop="0" scrollleft="0">
			<div class="content_block">
		    	<div class="xp_creat">
		    	<table>
		    		<tr>
						<td class="td1" nowrap style="vertical-align:top;">分类图片<font style="color:red;">*</font><br></td>
						<td class="rightTd">
							<div id="shopPicDiv" style="float:left;text-align:center;">
								<div id="imgDiv3" style="margin-bottom:10px;">
									<img src="" id="imgView3" style="height: 75px; width: 100px;">
									<!-- 
									<a href="javascript:deletePic()">删除</a>
									 -->
								</div>
								<div style="text-align:center;margin:0 18px;">
									<div id="file1" class="site-demo-upbar" style="">
									    <input type="file" name="file" class="layui-upload-file" id="test">
									</div>
								</div>
								<input id="sortPic" name="sortPic" type="hidden">
								<input id="addPicId" name="addPicId" type="hidden">
								<input id="level" name="level" type="hidden"/>
							</div>
							<div class="promptBox">
		                   		<div class='tips-errow' id="picTip" style="display:none;">请上传分类图片</div>
		                   		<div class='tips-ok' style="display:none;"></div>
		                   		<div class='tipsCur' style="display:none;">请上传分类图片</div>
		                   	</div>	
						</td>
					</tr>
		    	</table>
		        </div>
		    </div>
	    </div>
	</div>
</div>
</body>
<script type="text/javascript">
layui.use('upload', function(){
	  layui.upload({
	    url: '<%=path%>/upload/uploadPic'
	   	//,elem: '#test' //指定原始元素，默认直接查找class="layui-upload-file"
	    //,method: 'post' //上传接口的http类型
	    ,success: function(res){
	    	$("#sortPic").val(res.url);
			$("#imgView3").attr("src", res.url);
	    }
	  });
});
$(document).ready(function(){
		_reHeight("rightFrame","contentDiv");
 });
</script>
</html>
